using UnityEngine;
using UnityEngine.EventSystems;

public class UI_EquipmentSlot : UI_ItemSlot
{
    [SerializeField] private Sprite defaultSprite;
    private void OnValidate()
    {
        gameObject.name = "UI_EquipmentSlot - " + slotType.ToString();
    }
    public override void OnPointerDown(PointerEventData eventData)
    {
        if (itemInSlot == null)
            return;
        playerInventory.UnEquipItem(itemInSlot);
        
        itemToolTip.ShowToolTip(false, null);
    }
    public override void UpdateItemSlot(Inventory_Item inventoryItem)
    {
        itemInSlot = inventoryItem;
        if (inventoryItem == null)
        {
            itemIcon.sprite = defaultSprite;
            itemStackSize.text = "";
            return;
        }
        Color color = Color.white; color.a = .9f;
        itemIcon.color = color;
        itemIcon.sprite = inventoryItem.itemData.itemIcon;

        itemStackSize.text = inventoryItem.stackSize > 1 ? inventoryItem.stackSize.ToString() : "";
    }
}
